﻿using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using Util.Domains;
using Util.Domains.Auditing;

namespace IterationLife.Domains.Sports.Models {
    /// <summary>
    /// 体育比赛分组个人分段
    /// </summary>
    [Description( "体育比赛分组个人分段" )]
    public partial class SportEventGroupPersonSection : AggregateRoot<SportEventGroupPersonSection>,IDelete,IAudited {
        /// <summary>
        /// 初始化体育比赛分组个人分段
        /// </summary>
        public SportEventGroupPersonSection() : this( Guid.Empty ) {
        }

        /// <summary>
        /// 初始化体育比赛分组个人分段
        /// </summary>
        /// <param name="id">体育比赛分组个人分段标识</param>
        public SportEventGroupPersonSection( Guid id ) : base( id ) {
        }

        /// <summary>
        /// 体育比赛分组分段编号
        /// </summary>
        [Required(ErrorMessage = "体育比赛分组分段编号不能为空")]
        public Guid SportEventGroupSectionId { get; set; }
        /// <summary>
        /// 运动员编号
        /// </summary>
        [Required(ErrorMessage = "运动员编号不能为空")]
        public Guid SportAthleteId { get; set; }
        /// <summary>
        /// 开始时间
        /// </summary>
        [Required(ErrorMessage = "开始时间不能为空")]
        public DateTime StartTime { get; set; }
        /// <summary>
        /// 结束时间
        /// </summary>
        [Required(ErrorMessage = "结束时间不能为空")]
        public DateTime EndTime { get; set; }
        /// <summary>
        /// 个人分段数据
        /// </summary>
        public string JsonData { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreationTime { get; set; }
        /// <summary>
        /// 创建人
        /// </summary>
        public Guid? CreatorId { get; set; }
        /// <summary>
        /// 最后修改时间
        /// </summary>
        public DateTime? LastModificationTime { get; set; }
        /// <summary>
        /// 最后修改人
        /// </summary>
        public Guid? LastModifierId { get; set; }
        /// <summary>
        /// 是否删除
        /// </summary>
        [Required(ErrorMessage = "是否删除不能为空")]
        public bool IsDeleted { get; set; }
        
        /// <summary>
        /// 运动员
        /// </summary>
        public virtual IterationLife.Domains.Sports.Models.SportAthlete SportAthlete { get; set; }
        
        /// <summary>
        /// 体育比赛分组分段
        /// </summary>
        public virtual SportEventGroupSection SportEventGroupSection { get; set; }
        
        /// <summary>
        /// 添加描述
        /// </summary>
        protected override void AddDescriptions() {
            AddDescription( "体育比赛分组个人分段编号", Id );
            AddDescription( "体育比赛分组分段编号", SportEventGroupSectionId );
            AddDescription( "运动员编号", SportAthleteId );
            AddDescription( "开始时间", StartTime );
            AddDescription( "结束时间", EndTime );
            AddDescription( "个人分段数据", JsonData );
            AddDescription( "创建时间", CreationTime );
            AddDescription( "创建人", CreatorId );
            AddDescription( "最后修改时间", LastModificationTime );
            AddDescription( "最后修改人", LastModifierId );
        }
        
        /// <summary>
        /// 添加变更列表
        /// </summary>
        protected override void AddChanges( SportEventGroupPersonSection newEntity ) {
            AddChange( "Id", "体育比赛分组个人分段编号", Id, newEntity.Id );            
            AddChange( "SportEventGroupSectionId", "体育比赛分组分段编号", SportEventGroupSectionId, newEntity.SportEventGroupSectionId );
            AddChange( "SportAthleteId", "运动员编号", SportAthleteId, newEntity.SportAthleteId );
            AddChange( "StartTime", "开始时间", StartTime, newEntity.StartTime );
            AddChange( "EndTime", "结束时间", EndTime, newEntity.EndTime );
            AddChange( "JsonData", "个人分段数据", JsonData, newEntity.JsonData );
            AddChange( "CreationTime", "创建时间", CreationTime, newEntity.CreationTime );
            AddChange( "CreatorId", "创建人", CreatorId, newEntity.CreatorId );
            AddChange( "LastModificationTime", "最后修改时间", LastModificationTime, newEntity.LastModificationTime );
            AddChange( "LastModifierId", "最后修改人", LastModifierId, newEntity.LastModifierId );
        }
    }
}